<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>后台管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	    <meta charset="UTF-8">
    <title>后台管理</title>
	<link rel="stylesheet" type="text/css" href="UI/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="UI/css/main.css"/>
    <script type="text/javascript" src="UI/js/libs/modernizr.min.js"></script>
    <link href="UI/users/bootstrap/css/bootstrap.min.css" rel="stylesheet">
   	<script src="UI/users/bootstrap/js/bootstrap.min.js"></script>
	
  </head>
  
  <body>
<s:if test="null==#session.account">
	<s:a href="login.action" align="center"><h2>您不能直接访问网站内部页面,请先登录!</h2></s:a>
</s:if>
<s:else>
        <!--/sidebar-->

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">媒体管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
            	
                <form action="searchMedia" method="post">

                    <table class="search-tab">
                        <tr>
                            <th width="100">媒体名称:</th>
                            <td><input class="common-text" placeholder="输入媒体名称" name="media.filename" id="media.filename" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>

            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="preAddMedia"><i class="icon-font"></i>新增媒体</a>
                        <span>&nbsp;&nbsp;&nbsp;</span>
                        <a href="prePlayMediaTogether"><i class="icon-font"></i>播放媒体</a>
                    </div>                  
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                    	<thead>
	                        <tr>
	                            <!-- <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th> -->
	                            <th>媒体名称</th>
	                            <th>时长</th>
	                            <th>开始时间</th>
	                            <th>结束时间</th>
	                            <th>操作</th>
	                        </tr>
                    	</thead>
                        <tbody>          
	                        <s:iterator value="mediaList" var="media">
	                        	<tr>
		                        	<td><s:property value="#media.filename"/></td>
		                        	<td><s:property value="#media.length"/></td>
		                        	<td><s:property value="#media.startTime"/></td>
		                        	<td><s:property value="#media.endTime"/></td>
		                        	<td>
		                        		<%-- <a class="linck-detail" href="prePlayMedia?id=<s:property value='#media.id'/>" >播放</a> --%>
		                        		<a class="linck-detail" href="preCheckMediaInfo?id=<s:property value='#media.id'/>" >详情</a>
		                                <%-- <a class="link-update" href="preUpdateMedia?id=<s:property value="#media.id"/>">修改</a> --%>
		                                <a class="link-del" href="javascript:del(<s:property value='#media.id'/>)">删除</a>
		                            </td>
	                        	</tr>
	                        </s:iterator>
                        </tbody>
                    </table>
                    
                    <div align="center" class="result-content">
				    	<s:iterator value="pageBean">    
				        	<tr>    
				            	<td colspan="5" align="center" bgcolor="#5BA8DE">
				            	<br>
				            		共<strong><s:property value="allRow"/></strong>条记录        
 									共<strong><s:property value="totalPage"/></strong>页
 									当前第<strong><s:property value="currentPage"/></strong>页<br>    
				                    <s:if test="%{currentPage == 1}">
										第一页  上一页    
				                    </s:if>    
				                     <!-- currentPage为当前页 -->    
				                    <s:else>    
				                    	<a href="mediaList.action?page=1">第一页</a>    
				                        <a href="mediaList.action?page=<s:property value="%{currentPage-1}"/>">上一页</a>    
				                    </s:else>    
									<s:if test="%{currentPage != totalPage}">    
				                    	<a href="mediaList.action?page=<s:property value="%{currentPage+1}"/>">下一页</a>    
				                    	<a href="mediaList.action?page=<s:property value="totalPage"/>">最后一页</a>    
				                    </s:if>    
									<s:else>    
 										下一页  最后一页    
				                    </s:else>    
				                </td>    
				            </tr>    
				        </s:iterator> 
	                </div>  
                  
                </div>
            </form>
        </div>
    <!--/main-->
</s:else>
<script type="text/javascript">
	    //单独的删除一个商品
    function del(mediaId){
    	if(confirm("确定删除此商品?")){
    		window.location.href="deleteMedia?id="+mediaId;
 //不需要加参数，会自动注入进去
 //   		window.location.href="deleteMedia";
    	}
    	
    }
</script>
  </body>
</html>
